const urlVer = 'SJCGKF-94';

// 点击埋点
export function sendClickStat(cxt: string, toScode?: string) {
  const currentId = sessionStorage.getItem('userIdKey') || '';
  if (typeof hxmClickStat === 'function') {
    hxmClickStat(cxt, {
      url_ver: urlVer,
      to_scode: toScode,
      client_userid: currentId,
    });
  }
}

// 仅发一次的埋点方法，如曝光埋点发送
export function sendOnceStat(cxt: string) {
  const currentId = sessionStorage.getItem('userIdKey') || '';
  if (typeof hxmOnceStat === 'function') {
    hxmOnceStat(cxt, {
      url_ver: urlVer,
      client_userid: currentId,
    });
  }
}

// 页面埋点发送
export function sendPageStat(cxt: string) {
  const currentId = sessionStorage.getItem('userIdKey') || '';
  if (typeof hxmPageStat === 'function') {
    hxmPageStat(cxt, {
      url_ver: urlVer,
      client_userid: currentId,
    });
  }
}
